import axios, { url } from '.';
const login = async (data) => {
    let res = await axios({
        method: "post",
        url: url + "/admins/login",
        data
    })
    return res.data;
};

const userAll = async (data) => {
    let res = await axios({
        method: "get",
        url: url + "/admins",
        params:data
    })
    return res.data;
};

const del = async (id) => {
    let res = await axios({
        method: "delete",
        url: url + "/admins/" + id,
    })
    return res.data;
};

const idget = async (params) => {
    let res = await axios({
        method: "get",
        url: url + "/admins/" + params,
        params
    })
    return res.data;
};

export const add = async (data) => {
    let res = await axios({
        method: 'post',
        url: url + "/admins/add",
        data
    });
    return res.data;
};

export const set = async (data) => {
    let res = await axios({
        method: 'put',
        url: url + "/admins/" + data.id,
        data
    });
    return res.data;
};

export {
    login, userAll, del, idget
}